/*  controllers/CombinedCommodityController.js */
const dbFile = require('../model/CombinedCommodityModel');

const YEAR = '年';
const MONTH = '月';
const DAY = '日';
const DEFAULT_PAGE_SIZE = 10;
const SUCCESS_CODE = 200;


/**
 * Get news list by currentPage and pageSize.
 *
 * @param req request
 * @param res response
 */
const getCombinedCommodityList = (req, res) => {
  let {currentPage = 1, pageSize = DEFAULT_PAGE_SIZE} = req.query;
  let newsList = dbFile.combinedCommodityData.slice((currentPage - 1) * pageSize, currentPage * pageSize);
  res.send({ code: SUCCESS_CODE, data: newsList, msg: '' });
};


module.exports = {
  getCombinedCommodityList,
}